<?php
$uax = $_SERVER['HTTP_USER_AGENT'];
if (strpos($uax,'MSIE 8.0')||strpos($uax,'MSIE 7.0')||strpos($uax,'MSIE 6.0')||strpos($uax,'Firefox/3')||strpos($uax,'Firefox/2')||strstr($uax,'Opera')) {
	echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
} else {
	echo '<!DOCTYPE HTML>';
}

if (is_single()){
    if ($post->post_excerpt) {
        $description = $post->post_excerpt;
    } else {
        $description = substr(strip_tags($post->post_content),0,220);
    }
    $keywords = "";      
    $tags = wp_get_post_tags($post->ID);
    foreach ($tags as $tag ) {
        $keywords = $keywords . $tag->name . ", ";
    }
} else {
	$keywords = "UED, 前端, yotheme, html5, css3, 前端设计, 前端开发, WEB前端, 设计, 开发, 前端资源, CSS, JavaScript";
    $description = "yoUED - 专注于WEB前端，关注互联网。获取HTML5/CSS3/Wordpress主题yoTheme的最新动态。";
}
?>
<html>
<head>
	<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
	<meta name="keywords" content="<?php echo $keywords; ?>" /> 
	<meta name="description" content="<?php echo $description; ?>" /> 
	<title><?php
	/*
	 * Print the <title> tag based on what is being viewed.
	 */
	global $page, $paged;

	wp_title( '|', true, 'right' );

	// Add the blog name.
	bloginfo( 'name' );

	// Add the blog description for the home/front page.
	$site_description = get_bloginfo( 'description', 'display' );
	if ( $site_description && ( is_home() || is_front_page() ) )
		echo " | $site_description";

	// Add a page number if necessary:
	if ( $paged >= 2 || $page >= 2 )
		echo ' | ' . sprintf( __( 'Page %s', 'yotheme'), max( $paged, $page ) );

	?></title>
	<link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url'); ?>" media="all" />
	<link rel="shortcut icon" type="image/x-icon" href="<?php bloginfo('url'); ?>/favicon.ico" />
	<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
	<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/yotheme.js"></script>
	<!--[if IE 6]>
	<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/DD_belatedPNG_0.0.8a.js"></script>
	<script type="text/javascript">
		DD_belatedPNG.fix('#logo, .rssfeed, img');
	</script>
	<![endif]-->
	<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
	<link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />
	<link rel="alternate" type="application/atom+xml" title="Atom 1.0" href="<?php bloginfo('atom_url'); ?>" />
	<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
	<?php wp_get_archives('type=monthly&format=link'); ?>
	<?php wp_head(); ?>
	<?php if ( is_singular() ){ ?>
	<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/comments-ajax.js"></script>
	<?php } ?>
</head>
<body>
	<div id="container">
		<?php htmlUA('<div id="header">','<header>'); ?>
			<div id="logo"><a href="<?php echo home_url(); ?>" title="<?php bloginfo('description'); ?>"><h1><?php bloginfo('name'); ?></h1><span id="desc"><?php bloginfo('description'); ?></span></a></div>
			<?php htmlUA('<div id="mainmenu">','<nav id="mainmenu">'); ?>
			<?php wp_nav_menu(); ?>
			<?php htmlUA('</div>','</nav>'); ?>
			<a href="http://feed.youed.me/" target="_blank" title="<?php _e('Subscribe', 'yotheme'); ?>" class="rssfeed"><? _e('Subscribe', 'yotheme'); ?></a>
		<?php htmlUA('</div>','</header>'); ?>
		<div id="wrapper">